package com.yzy.fly.config.properties;

import com.yzy.fly.boot.banner.Banner;
import com.yzy.fly.boot.banner.BannerFactory;
import com.yzy.fly.util.ClassUtil;
import lombok.Data;

import java.io.Serializable;

@Data
public class BannerConfiguration implements Serializable {

    private boolean enable = true;
    private String bannerImpl;
    protected Class<? extends Banner> bannerImplClass;

    public void setBannerImpl(String bannerImpl) {
        Class<? extends Banner> bannerImplClass = ClassUtil.resolveClass(bannerImpl);
        if (bannerImplClass != null) {
            this.bannerImplClass = bannerImplClass;
            BannerFactory.useCustomBanner(this.bannerImplClass);
        }
    }

}
